package asia.yuanding.wechat.web.netty.vo;

import cn.hutool.json.JSONObject;
import lombok.Data;

/**
 * @ClassName: Result
 * @Author: YuanDing
 * @Date: 2025/8/5 23:47
 * @Description:
 */

@Data
public class Result {

    public Result(Object data, String type, String message , int code) {
        this.data = data;
        this.type = type;
        this.message = message;
        this.code = code;
    }

    private Object data;

    private String type;

    private String message;

    private int code;

    public static Result ok(String type , String message , Object data) {
      return new Result(data , type , message, 200 );
    };

    public static Result ok(String message) {
        return new Result(null, "system" , message , 200 );
    };

    public static Result ok(String type , Object data) {
        return new Result(data , type , null  , 200);
    };

    public static Result error(String message, Object data) {
        return new Result(data , "error" ,  message , 500);
    }

    public static Result error(String message, Object data , String type) {
        return new Result(data , type ,  message , 500);
    }


}
